#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk

ver    := $(DEB_UPSTREAM_VERSION)
soname := libdsdp-$(ver).so

debian/build-stamp:
	$(MAKE) DSDPROOT=`pwd` OPTFLAGS="-fPIC -O3" dsdpapi
	cd lib && \
		ar x libdsdp.a && \
		$(CC) -shared -Wl,-soname=$(soname) -o $(soname) *.o && \
		ln -s $(soname) libdsdp.so && rm *.o
	$(MAKE) DSDPROOT=`pwd` -C examples clean
	$(MAKE) DSDPROOT=`pwd` OPTFLAGS="-O3" DSDPLIB="-L$(CURDIR)/lib -ldsdp" example
	touch $@

clean::
	-$(MAKE) clean
	rm -f build-stamp

build/dsdp-doc:: debian/build-stamp
	cd docs/dox && doxygen

get-orig-source:
	uscan --rename --upstream-version 0 || true
	@echo successfully retrieved upstream tarball
